<?php
if ( !defined('IN_SEC') ){exit();}
?>
<?php include template("admin_header");?>
<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>
<?php include template("admin_breadcrumb");?>
					</div>

					<div class="page-content">
						<div class="page-header">
							<h1><?php echo $_G['admincp']['actname']; ?><small><i class="icon-double-angle-right"></i><?php echo $_G['admincp']['optname']; ?></small></h1>
						</div><!-- /.page-header -->

						<div class="row">
							<div class="col-xs-12">
								<!-- PAGE CONTENT BEGINS -->

								<div class="row">
									<div class="col-xs-12">
										<div class="table-responsive">
											<table id="sample-table-1" class="table table-striped table-bordered table-hover">
												<thead>
													<tr>
														<th class="center">
															<label>
																<input type="checkbox" class="ace" />
																<span class="lbl"></span>
															</label>
														</th>
														<th>id</th>
														<th>公司名称</th>
														<th>负责人</th>
														<th class="hidden-480">人数</th>
														<th>操作</th>
													</tr>
												</thead>

												<tbody>
					<?php if(is_array($companys)){foreach($companys AS $index=>$one) { ?>
													<tr>
														<td class="center">
															<label>
																<input type="checkbox" class="ace" /><span class="lbl"></span>
															</label>
														</td>

														<td><?php echo $one['id']; ?></td>
														<td><?php echo $one['name']; ?></td>
														<td><?php echo $one['contact']; ?></td>
														<td class="hidden-480"><?php echo intval($members[$one['id']]); ?></td>
														<td>
															<div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
																<a href="?action=account&operation=edit_company&id=<?php echo $one['id']; ?>" class="btn btn-xs btn-info">
																	<i class="icon-edit bigger-120"></i>
																</a>
															</div>

															<div class="visible-xs visible-sm hidden-md hidden-lg">
																<div class="inline position-relative">
																	<button class="btn btn-minier btn-primary dropdown-toggle" data-toggle="dropdown">
																		<i class="icon-cog icon-only bigger-110"></i>
																	</button>

																	<ul class="dropdown-menu dropdown-only-icon dropdown-yellow pull-right dropdown-caret dropdown-close">
																		<li>
																			<a href="?action=account&operation=edit_company&id=<?php echo $one['id']; ?>" class="tooltip-success" data-rel="tooltip" title="编辑">
																				<span class="green">
																					<i class="icon-edit bigger-120"></i>
																				</span>
																			</a>
																		</li>
																	</ul>
																</div>
															</div>
														</td>
													</tr>
<?php }}?>
												</tbody>
											</table>
										</div><!-- /.table-responsive -->
									</div><!-- /span -->
								</div><!-- /row -->

								<div class="hr hr-18 dotted hr-double"></div>
								<!-- PAGE CONTENT ENDS -->
							</div><!-- /.col -->
						</div><!-- /.row -->
					</div><!-- /.page-content -->
				</div>
		<!-- page specific plugin scripts -->
<?php include template("admin_footer");?>
		<script src="/static/ace/assets/js/jquery.dataTables.min.js"></script>
		<script src="/static/ace/assets/js/jquery.dataTables.bootstrap.js"></script>
		<!-- inline scripts related to this page -->

		<script type="text/javascript">
			jQuery(function($) {
				var oTable1 = $('#sample-table-2').dataTable( {
				"aoColumns": [
			      { "bSortable": false },
			      null, null,null, null, null,
				  { "bSortable": false }
				] } );
				
				
				$('table th input:checkbox').on('click' , function(){
					var that = this;
					$(this).closest('table').find('tr > td:first-child input:checkbox')
					.each(function(){
						this.checked = that.checked;
						$(this).closest('tr').toggleClass('selected');
					});
						
				});
			
			
				$('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
				function tooltip_placement(context, source) {
					var $source = $(source);
					var $parent = $source.closest('table')
					var off1 = $parent.offset();
					var w1 = $parent.width();
			
					var off2 = $source.offset();
					var w2 = $source.width();
			
					if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
					return 'left';
				}
			})
		</script>
</body>
</html>